// this is included by ThreeFishCore.cpp

namespace SkeinLib
{

	void SkeinLib::ThreeFishCore::Process256(const UInt64 input[], const UInt64 key[], const UInt64 tweak[], bool feed, UInt64 result[])
	{
		UInt64 buf0 = input[0]; 	UInt64 buf1 = input[1];		UInt64 buf2 = input[2];		UInt64 buf3 = input[3];
				
		UInt64 locKey0 = key[0];	UInt64 locKey1 = key[1];	UInt64 locKey2 = key[2];	UInt64 locKey3 = key[3];
		UInt64 locKey4 = ThreeFishCore::UniqueK(key, 4);
		
		UInt64 locTweak0 = tweak[0];
		UInt64 locTweak1 = tweak[1];
		UInt64 locTweak2 = (tweak[0] ^ tweak[1]);

		// *** GENERATED CODE:  SEE BuildThreeFishCPP PROJECT *** 
		//==256========================================================================================
		//KEYINJECT 0
		buf0 += locKey0;
		buf1 += locKey1 + locTweak0;
		buf2 += locKey2 + locTweak1;
		buf3 += locKey3 + 0;
		//Rounds 0 through 3
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 1
		buf0 += locKey1;
		buf1 += locKey2 + locTweak1;
		buf2 += locKey3 + locTweak2;
		buf3 += locKey4 + 1;
		//Rounds 4 through 7
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 2
		buf0 += locKey2;
		buf1 += locKey3 + locTweak2;
		buf2 += locKey4 + locTweak0;
		buf3 += locKey0 + 2;
		//Rounds 8 through 11
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 3
		buf0 += locKey3;
		buf1 += locKey4 + locTweak0;
		buf2 += locKey0 + locTweak1;
		buf3 += locKey1 + 3;
		//Rounds 12 through 15
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 4
		buf0 += locKey4;
		buf1 += locKey0 + locTweak1;
		buf2 += locKey1 + locTweak2;
		buf3 += locKey2 + 4;
		//Rounds 16 through 19
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 5
		buf0 += locKey0;
		buf1 += locKey1 + locTweak2;
		buf2 += locKey2 + locTweak0;
		buf3 += locKey3 + 5;
		//Rounds 20 through 23
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 6
		buf0 += locKey1;
		buf1 += locKey2 + locTweak0;
		buf2 += locKey3 + locTweak1;
		buf3 += locKey4 + 6;
		//Rounds 24 through 27
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 7
		buf0 += locKey2;
		buf1 += locKey3 + locTweak1;
		buf2 += locKey4 + locTweak2;
		buf3 += locKey0 + 7;
		//Rounds 28 through 31
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 8
		buf0 += locKey3;
		buf1 += locKey4 + locTweak2;
		buf2 += locKey0 + locTweak0;
		buf3 += locKey1 + 8;
		//Rounds 32 through 35
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 9
		buf0 += locKey4;
		buf1 += locKey0 + locTweak0;
		buf2 += locKey1 + locTweak1;
		buf3 += locKey2 + 9;
		//Rounds 36 through 39
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 10
		buf0 += locKey0;
		buf1 += locKey1 + locTweak1;
		buf2 += locKey2 + locTweak2;
		buf3 += locKey3 + 10;
		//Rounds 40 through 43
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 11
		buf0 += locKey1;
		buf1 += locKey2 + locTweak2;
		buf2 += locKey3 + locTweak0;
		buf3 += locKey4 + 11;
		//Rounds 44 through 47
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 12
		buf0 += locKey2;
		buf1 += locKey3 + locTweak0;
		buf2 += locKey4 + locTweak1;
		buf3 += locKey0 + 12;
		//Rounds 48 through 51
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 13
		buf0 += locKey3;
		buf1 += locKey4 + locTweak1;
		buf2 += locKey0 + locTweak2;
		buf3 += locKey1 + 13;
		//Rounds 52 through 55
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 14
		buf0 += locKey4;
		buf1 += locKey0 + locTweak2;
		buf2 += locKey1 + locTweak0;
		buf3 += locKey2 + 14;
		//Rounds 56 through 59
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 15
		buf0 += locKey0;
		buf1 += locKey1 + locTweak0;
		buf2 += locKey2 + locTweak1;
		buf3 += locKey3 + 15;
		//Rounds 60 through 63
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 16
		buf0 += locKey1;
		buf1 += locKey2 + locTweak1;
		buf2 += locKey3 + locTweak2;
		buf3 += locKey4 + 16;
		//Rounds 64 through 67
		buf0 += buf1; buf1 = _rotl64(buf1, 14); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 16); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 52); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 57); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 23); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 40); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 5); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 37); buf1 ^= buf2;
		//KEYINJECT 17
		buf0 += locKey2;
		buf1 += locKey3 + locTweak2;
		buf2 += locKey4 + locTweak0;
		buf3 += locKey0 + 17;
		//Rounds 68 through 71
		buf0 += buf1; buf1 = _rotl64(buf1, 25); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 33); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 46); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 12); buf1 ^= buf2;
		buf0 += buf1; buf1 = _rotl64(buf1, 58); buf1 ^= buf0;			buf2 += buf3; buf3 = _rotl64(buf3, 22); buf3 ^= buf2;
		buf0 += buf3; buf3 = _rotl64(buf3, 32); buf3 ^= buf0;			buf2 += buf1; buf1 = _rotl64(buf1, 32); buf1 ^= buf2;
		//KEYINJECT 18
		buf0 += locKey3;
		buf1 += locKey4 + locTweak0;
		buf2 += locKey0 + locTweak1;
		buf3 += locKey1 + 18;
		//==END 256====================================================================================
		// *** END OF GENERATED CODE:  SEE BuildThreeFishCPP PROJECT *** 
		
		if (feed)
		{
			result[0] = buf0 ^ input[0];
			buf0 ^= result[0] ^ input[0];
			result[1] = buf1 ^ input[1];
			buf1 ^= result[1] ^ input[1];
			result[2] = buf2 ^ input[2];
			buf2 ^= result[2] ^ input[2];
			result[3] = buf3 ^ input[3];
			buf3 ^= result[3] ^ input[3];
		}
		else
		{
			result[0] = buf0;
			buf0 ^= result[0];
			result[1] = buf1;
			buf1 ^= result[1];
			result[2] = buf2;
			buf2 ^= result[2];
			result[3] = buf3;
			buf3 ^= result[3];
		}
		return;
	}

	void SkeinLib::ThreeFishCore::InvProcess256(const UInt64 input[], const UInt64 key[], const UInt64 tweak[], UInt64 result[])
	{
		UInt64 buf0 = input[0]; 	UInt64 buf1 = input[1];		UInt64 buf2 = input[2];		UInt64 buf3 = input[3];
				
		UInt64 locKey0 = key[0];	UInt64 locKey1 = key[1];	UInt64 locKey2 = key[2];	UInt64 locKey3 = key[3];
		UInt64 locKey4 = ThreeFishCore::UniqueK(key, 4);
		
		UInt64 locTweak0 = tweak[0];
		UInt64 locTweak1 = tweak[1];
		UInt64 locTweak2 = (tweak[0] ^ tweak[1]);

				// *** GENERATED CODE:  SEE BuildThreeFishCPP PROJECT *** 
		//==256========================================================================================
		//KEYINJECT 18
		buf0 -= locKey3;
		buf1 -= (locKey4 + locTweak0);
		buf2 -= (locKey0 + locTweak1);
		buf3 -= (locKey1 + 18);
		//Rounds 72 through 75
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 17
		buf0 -= locKey2;
		buf1 -= (locKey3 + locTweak2);
		buf2 -= (locKey4 + locTweak0);
		buf3 -= (locKey0 + 17);
		//Rounds 68 through 71
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 16
		buf0 -= locKey1;
		buf1 -= (locKey2 + locTweak1);
		buf2 -= (locKey3 + locTweak2);
		buf3 -= (locKey4 + 16);
		//Rounds 64 through 67
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 15
		buf0 -= locKey0;
		buf1 -= (locKey1 + locTweak0);
		buf2 -= (locKey2 + locTweak1);
		buf3 -= (locKey3 + 15);
		//Rounds 60 through 63
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 14
		buf0 -= locKey4;
		buf1 -= (locKey0 + locTweak2);
		buf2 -= (locKey1 + locTweak0);
		buf3 -= (locKey2 + 14);
		//Rounds 56 through 59
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 13
		buf0 -= locKey3;
		buf1 -= (locKey4 + locTweak1);
		buf2 -= (locKey0 + locTweak2);
		buf3 -= (locKey1 + 13);
		//Rounds 52 through 55
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 12
		buf0 -= locKey2;
		buf1 -= (locKey3 + locTweak0);
		buf2 -= (locKey4 + locTweak1);
		buf3 -= (locKey0 + 12);
		//Rounds 48 through 51
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 11
		buf0 -= locKey1;
		buf1 -= (locKey2 + locTweak2);
		buf2 -= (locKey3 + locTweak0);
		buf3 -= (locKey4 + 11);
		//Rounds 44 through 47
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 10
		buf0 -= locKey0;
		buf1 -= (locKey1 + locTweak1);
		buf2 -= (locKey2 + locTweak2);
		buf3 -= (locKey3 + 10);
		//Rounds 40 through 43
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 9
		buf0 -= locKey4;
		buf1 -= (locKey0 + locTweak0);
		buf2 -= (locKey1 + locTweak1);
		buf3 -= (locKey2 + 9);
		//Rounds 36 through 39
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 8
		buf0 -= locKey3;
		buf1 -= (locKey4 + locTweak2);
		buf2 -= (locKey0 + locTweak0);
		buf3 -= (locKey1 + 8);
		//Rounds 32 through 35
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 7
		buf0 -= locKey2;
		buf1 -= (locKey3 + locTweak1);
		buf2 -= (locKey4 + locTweak2);
		buf3 -= (locKey0 + 7);
		//Rounds 28 through 31
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 6
		buf0 -= locKey1;
		buf1 -= (locKey2 + locTweak0);
		buf2 -= (locKey3 + locTweak1);
		buf3 -= (locKey4 + 6);
		//Rounds 24 through 27
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 5
		buf0 -= locKey0;
		buf1 -= (locKey1 + locTweak2);
		buf2 -= (locKey2 + locTweak0);
		buf3 -= (locKey3 + 5);
		//Rounds 20 through 23
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 4
		buf0 -= locKey4;
		buf1 -= (locKey0 + locTweak1);
		buf2 -= (locKey1 + locTweak2);
		buf3 -= (locKey2 + 4);
		//Rounds 16 through 19
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 3
		buf0 -= locKey3;
		buf1 -= (locKey4 + locTweak0);
		buf2 -= (locKey0 + locTweak1);
		buf3 -= (locKey1 + 3);
		//Rounds 12 through 15
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 2
		buf0 -= locKey2;
		buf1 -= (locKey3 + locTweak2);
		buf2 -= (locKey4 + locTweak0);
		buf3 -= (locKey0 + 2);
		//Rounds 8 through 11
		buf3 ^= buf0; buf3 = _rotr64(buf3, 32); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 32); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 58); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 22); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 46); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 12); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 25); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 33); buf2 -= buf3;
		//KEYINJECT 1
		buf0 -= locKey1;
		buf1 -= (locKey2 + locTweak1);
		buf2 -= (locKey3 + locTweak2);
		buf3 -= (locKey4 + 1);
		//Rounds 4 through 7
		buf3 ^= buf0; buf3 = _rotr64(buf3, 5); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 37); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 23); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 40); buf2 -= buf3;
		buf3 ^= buf0; buf3 = _rotr64(buf3, 52); buf0 -= buf3;			buf1 ^= buf2; buf1 = _rotr64(buf1, 57); buf2 -= buf1;
		buf1 ^= buf0; buf1 = _rotr64(buf1, 14); buf0 -= buf1;			buf3 ^= buf2; buf3 = _rotr64(buf3, 16); buf2 -= buf3;
		//KEYINJECT 0
		buf0 -= locKey0;
		buf1 -= (locKey1 + locTweak0);
		buf2 -= (locKey2 + locTweak1);
		buf3 -= (locKey3 + 0);
		//==END 256====================================================================================
		// *** END OF GENERATED CODE:  SEE BuildThreeFishCPP PROJECT *** 


		result[0] = buf0;
		buf0 ^= result[0];
		result[1] = buf1;
		buf1 ^= result[1];
		result[2] = buf2;
		buf2 ^= result[2];
		result[3] = buf3;
		buf3 ^= result[3];

		return;
	}
}